<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="ISO-8859-1">
		<title>Insert title here</title>
		<link rel="stylesheet"  href="/wk1un2/Backstage/lib/layui/css/layui.css" />
		<style type="text/css">
			
body,html{
    margin:0 0 0 0;
    overflow:hidden hidden;
}
		</style>
	</head>

	<body>
		<form class="layui-form" action="">
			
<!--公司介绍-->
			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">公司介绍</label>
				<div class="layui-input-block">
					<textarea name="homeInfo" placeholder="请输入内容" class="layui-textarea">
					
					${f.homeInfo }
					</textarea>
				</div>
			</div>
			<!--详细介绍-->
			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">详细介绍</label>
				<div class="layui-input-block">
					<textarea name="info" placeholder="请输入内容" class="layui-textarea">
					${f.info }
					</textarea>
				</div>
			</div>
			<!--企业文化-->
			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">企业文化</label>
				<div class="layui-input-block">
					<textarea name="culture" placeholder="请输入内容" class="layui-textarea">
					${f.culture }
					</textarea>
				</div>
			</div>
			<!--招商电话-->
			<div class="layui-form-item">
				<label class="layui-form-label">招商电话</label>
				<div class="layui-input-block">
					<input type="text" name="zsTel" value="${f.zsTel }" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
			</div>
			<!--联系电话-->
			<div class="layui-form-item">
				<label class="layui-form-label">联系电话</label>
				<div class="layui-input-block">
					<input type="text" name="lxTel" value="${f.lxTel }" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
			</div>
			<!--公司邮箱-->
			<div class="layui-form-item">
				<label class="layui-form-label">公司邮箱</label>
				<div class="layui-input-block">
					<input type="text" name="email" value="${f.email }" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
			</div>
			</div>
			
			<!--公司地址-->
			<div class="layui-form-item">
				<label class="layui-form-label">公司地址</label>
				<div class="layui-input-block">
					<input type="text" name="address" value="${f.address }" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
				<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
			
		</form>
<script src="/wk1un2/Backstage/lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
		<script>
			//Demo
			layui.use('form', function() {
				var form = layui.form;
				var $ = layui.jquery; //引入jquery

				//监听提交
				/* form.on('submit(formDemo)', function(data) {
					layer.msg(JSON.stringify(data.field)); */
					form.on('submit(formDemo)', function(data) {
						var d = data.field; //表单中的数据，定义一个对象来接收
						d.method = "updateHomeinfo"; 
						//通过ajax向数据库提交数据了
						console.log(d); //提交之前的一个数据验证、通过打印的方式先手动的去判断一下这个数据
						var url = 'HouHomeInfoServlet';
						//确保数据没有问题就进行ajax提交了
						$.post(url, d,
							function(data) {
								if(data.count>0){
									 layer.log('修改成功');
									 
									 window.location.reload();//刷新页面
								}
							}, "json");
					return false;
				});
			});
		</script>
	</body>

</html>